-
Notifications
You must be signed in to change notification settings - Fork 3
fix: 타이밍 문제로 init 받아지지 않는 문제 해결 #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Walkthrough이 변경 사항들은 주로 불필요한 import 문을 제거하고, 로깅을 추가하며, 메시지 큐 소비자에서 비동기 제출 처리 전에 6초간 대기하는 로직을 도입했습니다. 기능적 로직 변경은 없으며, 코드의 가독성과 추적성을 개선하는 데 중점을 두었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant RedisJudgeQueueConsumer
participant SubmissionService
RedisJudgeQueueConsumer->>RedisJudgeQueueConsumer: 메시지 수신 로그 출력
RedisJudgeQueueConsumer->>RedisJudgeQueueConsumer: 6초 대기 (Thread.sleep)
RedisJudgeQueueConsumer->>SubmissionService: processSubmissionAsync(msg) 호출
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/org/ezcode/codetest/infrastructure/event/publisher/StompMessageService.java (1)
65-65: 로그 메시지 개선 제안현재 로그 메시지가 간단하여 디버깅 시 더 많은 정보가 필요할 수 있습니다.
다음과 같이 더 상세한 정보를 포함하는 것을 고려해보세요:
- log.info("init 발행"); + log.info("[STOMP] init 테스트케이스 발행 - sessionKey: {}, user: {}, count: {}", sessionKey, principalName, dataList.size()); - log.info("case 발행"); + log.info("[STOMP] 테스트케이스 결과 발행 - sessionKey: {}, user: {}, result: {}", sessionKey, principalName, data.isCorrect()); - log.info("final 발행"); + log.info("[STOMP] 최종 결과 발행 - sessionKey: {}, user: {}, status: {}", sessionKey, principalName, data.getOverallStatus());Also applies to: 78-78, 91-91
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java(0 hunks)src/main/java/org/ezcode/codetest/infrastructure/event/listener/RedisJudgeQueueConsumer.java(1 hunks)src/main/java/org/ezcode/codetest/infrastructure/event/publisher/StompMessageService.java(4 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/org/ezcode/codetest/application/submission/service/SubmissionService.java
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:159-165
Timestamp: 2025-06-28T02:03:38.693Z
Learning: User thezz9's service (ezcode) targets Korean users exclusively ("찐 한국인밖에 안 옴"), so Korean language hardcoding in commit messages and UI elements is intentional and appropriate for their use case.
Learnt from: thezz9
PR: ezcode-my/backend#111
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:58-73
Timestamp: 2025-06-27T09:53:52.378Z
Learning: User thezz9 acknowledges technical issues when flagged but often indicates they will address them later ("나중에 바꿀 겨"), suggesting they prioritize getting core functionality working first before refining implementation details.
Learnt from: chat26666
PR: ezcode-my/backend#37
File: src/main/java/org/ezcode/codetest/infrastructure/elasticsearch/repository/ProblemElasticsearchRepositoryDsl.java:10-10
Timestamp: 2025-06-06T19:56:27.759Z
Learning: When user chat26666 mentions that code was implemented in a previous PR but explanation was missing, they may submit a follow-up PR just to add documentation/explanation without the actual implementation code.
Learnt from: thezz9
PR: ezcode-my/backend#30
File: src/main/java/org/ezcode/codetest/domain/problem/model/dto/SubmissionData.java:42-53
Timestamp: 2025-06-04T13:12:16.729Z
Learning: 사용자 thezz9는 개발 시 기능적 정확성을 먼저 달성한 후 세부 리팩터링을 나중에 하는 접근 방식을 선호한다. 테스트 단계에서는 하드코딩된 값도 허용한다.
Learnt from: thezz9
PR: ezcode-my/backend#75
File: src/main/java/org/ezcode/codetest/application/submission/aop/CodeReviewLockAspect.java:25-41
Timestamp: 2025-06-19T06:37:57.845Z
Learning: User thezz9 tends to skip validation for scenarios they consider unlikely to occur, but is willing to implement defensive programming practices when suggested for code robustness.
Learnt from: thezz9
PR: ezcode-my/backend#114
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubApiClient.java:93-96
Timestamp: 2025-06-28T02:04:24.957Z
Learning: User thezz9 sometimes temporarily uses less secure or inconsistent exception handling (like RuntimeException with raw error bodies) for debugging purposes when error messages are being hidden in the normal application flow, but acknowledges this as technical debt and fixes it once debugging is complete.
Learnt from: thezz9
PR: ezcode-my/backend#132
File: src/main/java/org/ezcode/codetest/infrastructure/github/GitHubContentBuilder.java:72-72
Timestamp: 2025-07-02T09:39:31.475Z
Learning: User thezz9 prefers to proceed with breaking changes to path structures when it improves the organization, rather than maintaining backward compatibility or implementing migration strategies.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (1)
src/main/java/org/ezcode/codetest/infrastructure/event/publisher/StompMessageService.java (1)
17-19: 로깅 기능 추가 승인디버깅과 모니터링을 위한 로깅 추가가 적절합니다.
|
|
||
| try { | ||
| log.info("[컨슈머 수신] {}", msg.sessionKey()); | ||
| Thread.sleep(6000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
❓ Verification inconclusive
임시 해결책으로 Thread.sleep 사용 - 향후 개선 필요
타이밍 이슈 해결을 위한 임시 방편으로 이해되지만, 다음 사항들을 고려해 주세요:
- 성능 영향: 블로킹 방식으로 처리량 저하 가능성
- 리소스 낭비: 스레드 풀의 스레드가 6초간 대기 상태로 유지
- 불확실성: 6초가 항상 충분한 시간인지 보장되지 않음
향후 개선 방안:
- CompletableFuture.delayedExecutor() 사용한 비동기 지연 처리
- Redis pub/sub 기반의 이벤트 동기화
- 초기화 완료 신호를 확인하는 polling 메커니즘
// 향후 개선 예시 (비동기 지연 처리)
CompletableFuture.delayedExecutor(6, TimeUnit.SECONDS)
.execute(() -> submissionService.processSubmissionAsync(msg));Thread.sleep(6000) 제거 및 비동기 지연 처리 도입 필요
현재 Redis 스트림 메시지 컨슈머에서 Thread.sleep(6000)을 사용한 고정 대기는 다음 문제를 유발할 수 있습니다:
- 성능 저하: 스레드가 블로킹되어 처리량 감소
- 리소스 낭비: 스레드 풀이 불필요하게 점유
- 불확실성: 6초가 항상 적절한 지점 보장 불가
아래와 같은 비동기 지연 처리 방식으로 교체를 권장합니다:
// CompletableFuture.delayedExecutor() 사용 예시
CompletableFuture
.delayedExecutor(6, TimeUnit.SECONDS)
.execute(() -> submissionService.processSubmissionAsync(msg));또는 Redis pub/sub 이벤트 기반 동기화, 초기화 완료 신호 확인용 폴링 메커니즘 등으로 개선해 주세요.
[src/main/java/org/ezcode/codetest/infrastructure/event/listener/RedisJudgeQueueConsumer.java:39]
🤖 Prompt for AI Agents
In
src/main/java/org/ezcode/codetest/infrastructure/event/listener/RedisJudgeQueueConsumer.java
at line 39, replace the blocking Thread.sleep(6000) call with a non-blocking
asynchronous delay using CompletableFuture.delayedExecutor to avoid thread
blocking and improve performance. Implement the delay by scheduling the
subsequent processing logic inside the delayedExecutor's execute method, or
alternatively use an event-driven or polling mechanism to handle synchronization
without fixed thread sleeps.
일단 임시방편으로 thread.sleep 6초 걸어뒀습니다.
이러니 init이 유실 안 되네요.. 더 나은 방법을 찾아야할 거 같습니다.
Summary by CodeRabbit
신규 기능
버그 수정
기타